package com.cq.hd.product.factory;

import java.util.HashMap;
import java.util.Map;

public class ActiveReleaseFactory {

    private static final Map<Integer, AbstractActiveReleaseHandler> STRATEGY_MAP = new HashMap<>();

    public static void register(Integer markType, AbstractActiveReleaseHandler strategy) {
        STRATEGY_MAP.put(markType, strategy);
    }

    public static AbstractActiveReleaseHandler getActiveReleaseHandler(Integer activeType) {
        AbstractActiveReleaseHandler abstractActiveReleaseHandler = STRATEGY_MAP.get(activeType);
        if (abstractActiveReleaseHandler == null) {
            throw new RuntimeException("处理类为空");
        }
        return abstractActiveReleaseHandler;
    }

}
